package world.snowcrystal.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.temporal.ChronoUnit;

@Data
@ConfigurationProperties("snowcrystal.chatroom")
public class ChatroomProperties {

    private static final String CHATROOM_PREFIX = "SNOWCRYSTAL_CHATROOM";

    private static final String DEFAULT_CHATROOM_CHANNEL = "SNOWCRYSTAL_CHATROOM:CHANNEL";

    private static final String DEFAULT_CHATROOM_CACHE_SET_NAME = "SNOWCRYSTAL_CHATROOM:MESSAGE_CACHE";

    private static final String DEFAULT_CHATROOM_ONLINE_COUNTER = "SNOWCRYSTAL_CHATROOM_ONLINE_COUNTER";

    private static final String DEFAULT_CHATROOM_USER_CACHE = "SNOWCRYSTAL_CHATROOM:USER_CACHE";

    private String chatroomChannel = DEFAULT_CHATROOM_CHANNEL;


    /**
     * 存储在缓存服务器上的消息队列的 key 值
     * @since 1.0
     */
    private String chatroomCacheSet = DEFAULT_CHATROOM_CACHE_SET_NAME;

//    /**
//     * 存储在缓存服务器上的在线人数统计的 key 值
//     * @since 1.0
//     */
//    private String chatroomOnlineCounter = DEFAULT_CHATROOM_ONLINE_COUNTER;

    /**
     * 用户队列缓存的 key
     * @since 1.0
     */
    private String chatroomUserCacheSet = DEFAULT_CHATROOM_USER_CACHE;

    /**
     * 消息的缓存时长。默认
     * @since 1.0
     */
    private Long chatroomMessageExpirationTime = 128L;

    /**
     * 消息的缓存时长单位
     * @since 1.0
     */
    private ChronoUnit chatroomMessageExpirationTimeUnit = ChronoUnit.DAYS;

    /**
     * 聊天室用户ttl，当超过这个时长时，将判定用户不在聊天室中；单位秒
     * @since 1.0
     */
    private Long chatroomUserExpirationTime = 120L;


    private String chatroomAnonymousUserPrefix = "Anony";





}
